import { Component } from '@angular/core';
import { Platform, NavController } from 'ionic-angular';

import { newdetailPage } from '../newdetail/newdetail';//新闻详细页
import { PubApi } from '../../providers/pubapi';


@Component({
    selector: 'page-news',
    templateUrl: 'news.html'
})


export class NewsPage {

    items: any = [
       
      
    ];

    constructor(public platform: Platform, public navCtrl: NavController, public pubapi: PubApi) {

        platform.ready().then(() => { });

    }


    ionViewDidEnter() {
        var that =this;
          this.pubapi.get("BlocNews/SelectAll", function (res) {
            let r = res.data;
            r.forEach((item) => {
                that.items.push(item.NewsTitle);
            })
           
        })


    }
    itemSelectedNew(item) {
        this.navCtrl.push(newdetailPage, {
            new: item
        });


    }
}

